package service.impl;

import dao.ConversationDao;
import pojo.Conversation;
import service.ConversationService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class ConversationServiceImpl implements ConversationService {

    @Autowired
    private ConversationDao conversationDao;

    @Override
    public Conversation getById(Integer id) {
        return conversationDao.selectById(id);
    }
    @Override
    public List<Conversation> getByUserIdAndDoctorId(Integer userId, String doctorId) {
        return conversationDao.getByUserIdAndDoctorId(userId, doctorId);
    }
    @Override
    public List<Conversation> getByUserId(Integer userId) {
        return conversationDao.selectByUserId(userId);
    }

    @Override
    public List<Conversation> getByDoctorId(String doctorId) {
        return conversationDao.selectByDoctorId(doctorId);
    }

    @Override
    public int add(Conversation conversation) {
        return conversationDao.insert(conversation);
    }

    @Override
    public int update(Conversation conversation) {
        return conversationDao.update(conversation);
    }

    @Override
    public int delete(Integer id) {
        return conversationDao.delete(id);
    }
}